package com.boost.tjvm.oom;

/**
 * java 虚拟机栈内存溢出，因为虚拟机栈是 一个线程一块区域所以
 * 设置为单线程为2兆内存
 */
public class JavaVMStackOOM {

    private void dontStop(){
        while(true){

        }
    }

    public void stackLeakByThread(){
        while (true){

            Thread t=new Thread(()->{
                dontStop();
            });
            t.start();
        }
    }

    public static void main(String [] args){
        // -Xss2M
        JavaVMStackOOM javaVMStackOOM=new JavaVMStackOOM();
        javaVMStackOOM.stackLeakByThread();
    }

}
